import http from "@/api";
import { ListQueryParams, PostDetail, PostList } from "@/api/interface/post";

// * 获取全部菜单列表
export const getPostList = (params: ListQueryParams) => {
	return http.get<PostList>({
		url: `/post/list`,
		params
	});
};

// 获取文章详情

export const getPostById = (postId: string) => {
	return http.get<PostDetail>({
		url: `/post/getPostById/${postId}`
	});
};

// * 下架文章
export const takeDownPost = (postId: string) => {
	return http.post({
		url: `/post/takeDownPost`,
		data: { postId }
	});
};

// * 上架文章
export const uploadedPost = (postId: string) => {
	return http.post<PostList>({
		url: `/post/uploadedPost`,
		data: { postId }
	});
};

// * 上架文章
export const deletePost = (postId: string) => {
	return http.delete<PostList>({
		url: `/post/deletePost/` + postId
	});
};
